package com.dys.designpattern.factorymethod.applyaward.service.impl;

import com.alibaba.fastjson2.JSON;
import com.dys.designpattern.factorymethod.applyaward.entity.AwardInfo;
import com.dys.designpattern.factorymethod.applyaward.entity.SmallGiftInfo;
import com.dys.designpattern.factorymethod.applyaward.service.IFreeGoods;
import com.dys.designpattern.factorymethod.applyaward.vo.ResponseResult;

import java.util.UUID;

/**
 * @Author: 疾风
 * @ClassName: SmallGiftFreeGoods
 * @Description: 小礼品发放服务
 * @CreateDate: 2024/05/13
 * @Version: v1.0.0
 */
public class SmallGiftFreeGoods implements IFreeGoods {
    @Override
    public ResponseResult sendFreeGoods(AwardInfo awardInfo) {
        SmallGiftInfo smallGiftInfo = new SmallGiftInfo();
        smallGiftInfo.setOrderId(UUID.randomUUID().toString());
        smallGiftInfo.setUserName(awardInfo.getExtMap().get("username"));
        smallGiftInfo.setUserPhone(awardInfo.getExtMap().get("phone"));
        smallGiftInfo.setRelAddress(awardInfo.getExtMap().get("address"));
        System.out.println("小礼品发放成功,请注意查收!" + JSON.toJSON(smallGiftInfo));
        return new ResponseResult("200", "小礼品发放成功!", smallGiftInfo);
    }
}
